package jk.fox.transport.netty;

import jk.fox.common.payload.message.MessageDispatcher;
import jk.fox.config.transport.netty.NettyConfiguration;
import jk.fox.transport.ClientTransporter;
import jk.fox.transport.ServerTransporter;
import jk.fox.transport.Transport;
import jk.fox.transport.netty.server.NettyServerTransporter;
import jk.fox.transport.netty.client.NettyClientTransporter;

/**
 * @author cuichao
 * @Description: NettyTransport
 * @Date: create in 2020/6/2 16:16
 */
public class NettyTransport implements Transport {

    private NettyConfiguration config;
    private MessageDispatcher messageDispatcher;

    public NettyTransport(NettyConfiguration config,MessageDispatcher messageDispatcher) {
        this.config = config;
        this.messageDispatcher = messageDispatcher;
    }


    @Override
    public ClientTransporter client() {
        return new NettyClientTransporter(config,messageDispatcher);
    }

    @Override
    public ServerTransporter server() {
        return new NettyServerTransporter(config,messageDispatcher);
    }

}
